From f332dbeb9fba44f98efccf15fd6893cfc37dd33e Mon Sep 17 00:00:00 2001 From: oliskoli Date: Sat, 29 Apr 2006 21:57:05 +0000 Subject: [PATCH] Fix memory leaks. --- gpsbabel/interpolate.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gpsbabel/interpolate.c b/gpsbabel/interpolate.c index f5a1d9c4a..f054ae4a4 100644 --- a/gpsbabel/interpolate.c +++ b/gpsbabel/interpolate.c @@ -83,12 +83,9 @@ interpfilt_process(void) timen += interval ) { waypoint *wpt_new = waypt_dupe(wpt); wpt_new->creation_time = timen; - xfree(wpt_new->shortname); - if (wpt_new->description) { - xfree(wpt_new->description); - wpt_new->description = NULL; - } - wpt_new->shortname = wpt_new->description = 0; + if (wpt_new->shortname) xfree(wpt_new->shortname); + if (wpt_new->description) xfree(wpt_new->description); + wpt_new->shortname = wpt_new->description = NULL; linepart( lat1, lon1, wpt->latitude, wpt->longitude, (double)(timen-time1)/ @@ -112,12 +109,9 @@ interpfilt_process(void) waypoint *wpt_new = waypt_dupe(wpt); wpt_new->creation_time = distn/curdist* (wpt->creation_time - time1) + time1; - xfree(wpt_new->shortname); - if (wpt_new->description) { - xfree(wpt_new->description); - wpt_new->description = NULL; - } - wpt_new->shortname = wpt_new->description = 0; + if (wpt_new->shortname) xfree(wpt_new->shortname); + if (wpt_new->description) xfree(wpt_new->description); + wpt_new->shortname = wpt_new->description = NULL; linepart( lat1, lon1, wpt->latitude, wpt->longitude, distn/curdist, -- 2.30.2